<template>
  <Container>
    <div slot="main" class="container-fluid">
      <h2>错误代码:</h2>
      <h3>{{errorCode}}</h3>
      <h2>错误描述:</h2>
      <h3>{{errorDescription}}</h3>
      <h2>时间:</h2>
      <h3>{{NowTime.format()}}</h3>
    </div>
    <div slot="footer" class="container">
      <div class="center-block text-center">
        <el-button type="back" icon="icon-caret-left" v-on:click="back">返回</el-button>
      </div>
    </div>
  </Container>
</template>
<script>
export default {
  data() {
    return {
      NowTime: new Date(),
      ErrorList: [
        { Code: "400", Description: "系统错误" },
        { Code: "401", Description: "没有权限访问" },
        { Code: "404", Description: "没有相关资源" },
        { Code: "500", Description: "服务器连接错误，请检查网络" },
        { Code: "503", Description: "服务器连接错误" },
      ]
    };
  },
  computed: {
    errorCode() {
      return this.$route.params.code;
    },
    errorDescription() {
      return this.ErrorList.singleOrDefault(
        e => e.Code == this.$route.params.code
      ).Description;
    },
    fromRoutePath() {
      return this.$route.params.from;
    }
  },
  created() {},
  methods: {
    back() {
      this.$router.push(this.fromRoutePath.urlDecode());
    }
  }
};
</script>